package com.mskj.p3.service.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mskj.p3.dao.HobbyDao;
import com.mskj.p3.model.Hobby;
import com.mskj.p3.model.User;
import com.mskj.p3.service.HobbyService;

@Service
public class HobbyServiceImp implements HobbyService {
	
	@Autowired
	private HobbyDao hobbydao;
	
	@Override
	public List<Hobby> queryHobby(User u) {
		List<Hobby> hobbylist = hobbydao.queryHobby(u);
		return hobbylist;
	}

	@Override
	public boolean deleteHobby(Hobby h, User u) {
	
		 return hobbydao.deletehobby(h, u);
	}

	@Override
	public boolean addhobbys(User u, Hobby h) {
		if(hobbydao.gethobby(h)==false){
			hobbydao.addhobby(h);		
		}
		return hobbydao.addchoose(u, h);
	}

}
